package day17.myRelect2;

import java.lang.reflect.Field;

public class RElectDemo3 {
    public static void main(String[] args) throws ClassNotFoundException, NoSuchFieldException {
        //method1();
        //method2();
        //method3();
        //method4();

    }

    private static void method4() throws ClassNotFoundException {
        Class clazz=Class.forName("day17.myRelect2.Student");
        Field[] fields = clazz.getFields();
        for (Field field : fields) {
            System.out.println(field);
        }
    }

    private static void method3() throws ClassNotFoundException {
        Class clazz=Class.forName("day17.myRelect2.Student");
        Field[] declaredFields = clazz.getDeclaredFields();
        for (Field declaredField : declaredFields) {
            System.out.println(declaredField);
        }
    }

    private static void method2() throws ClassNotFoundException, NoSuchFieldException {
        Class clazz=Class.forName("day17.myRelect2.Student");
        Field name = clazz.getDeclaredField("name");
        System.out.println(name);
    }

    private static void method1() throws ClassNotFoundException, NoSuchFieldException {
        Class clazz=Class.forName("day17.myRelect2.Student");
        Field money = clazz.getField("money");
        System.out.println(money);
    }
}
